enroll: R15 — || die on mktemp, sed -i, write_enroll_nix, katello-setup#187
Merged
Conversation
Seven LOW findings:
- mktemp (x3 at lines 403, 407, 723): || die if /tmp or SOURCEOS_DIR is full.
- sed -i (x2): || die on the sed command itself. The existing post-grep checks
only catch "sed exited 0 but changed nothing"; a non-zero sed exit (e.g. disk
full during in-place temp file write) would previously fire set -e silently.
- write_enroll_nix: wrap heredoc in { } || die and add || die to mv. Call site
already had no guard because the function had no internal die calls.
- katello-sourceos-setup.sh: add existence check (|| die) before invoking it
and || die on the bash call itself so API failures surface a clear message.
- _KATELLO_RUNNING / _KATELLO_FINAL docker ps pipelines: append || echo 0 so
that a Docker daemon crash between `up -d` and the count check does not fire
set -e silently; the count falls to 0 and the existing die guard triggers.
- printf > PLAINTEXT: || die on the write to the sops plaintext temp file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Round 15 audit — all LOW
mktemp× 3 (lines 403, 407, 723)|| die— full/tmporSOURCEOS_DIRfiresset -esilentlysed -i× 2 (lines 294-295)write_enroll_nix(heredoc + mv)cat > .tmp <<NIXandmvboth unguarded inside the functionbash katello-sourceos-setup.sh|| dieon bash invocation_KATELLO_RUNNINGdocker ps pipelineup -dand count check firesset -esilently_KATELLO_FINALdocker ps pipelineprintf ... > "${PLAINTEXT}"|| dieon plaintext secrets writeChanges
mktemp ... || dieon all three mktemp callssed -i ... || dieon both in-place edits{ cat > .tmp <<NIX ... NIX } || die+mv ... || dieinsidewrite_enroll_nix[[ -f katello-sourceos-setup.sh ]] || die+bash ... || diein step 5... | wc -l | tr -d ' ' || echo 0on both docker ps count pipelinesprintf ... > "${PLAINTEXT}" || diein step 6 sops blockTest plan
bash -n scripts/enroll.shpasses (verified)